package com.llgz.hotelmanageapi.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.llgz.hotelmanageapi.common.CommonResult;
import com.llgz.hotelmanageapi.pojo.DO.CheckinInfo;
import com.llgz.hotelmanageapi.pojo.DTO.CheckinPageDTO;
import com.llgz.hotelmanageapi.pojo.VO.checkinPageVo;
import com.llgz.hotelmanageapi.service.impl.CheckinInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.llgz.hotelmanageapi.common.CommonResult;
import com.llgz.hotelmanageapi.pojo.DAO.CheckinInfoDAO;
import com.llgz.hotelmanageapi.pojo.DO.OrderInfo;
import com.llgz.hotelmanageapi.service.impl.CheckinInfoServiceImpl;
import com.llgz.hotelmanageapi.service.impl.OrderInfoServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 入住信息 前端控制器
 * </p>
 *
 * @author Bernie_fang
 * @since 2021-07-19
 */
@RestController
@RequestMapping("/checkinInfo")
@RequiresRoles(value = {"root", "admin", "manager", "reception"}, logical = Logical.OR)
public class CheckinInfoController {

    @Autowired
    private CheckinInfoServiceImpl checkinInfoService;

    @Autowired
    OrderInfoServiceImpl orderInfoService;

    // 查询所有入住信息
    @PostMapping("/queryCheckinInfo")
    @ApiOperation(value = "查询所有入住信息",response = CommonResult.class,httpMethod = "POST")
    public CommonResult queryCheckinInfo(@RequestBody CheckinPageDTO checkinPageDTO){
        IPage<checkinPageVo> checkinPageVoIPage = checkinInfoService.queryCheckinInfo(checkinPageDTO);
        return CommonResult.successResponse(checkinPageVoIPage);
    }

    @PostMapping("/checkIn")
    @ApiOperation(value = "更新", response = CommonResult.class, httpMethod = "POST")
    public CommonResult checkIn(@RequestBody CheckinInfoDAO checkinInfoDAO){
        Boolean check = checkinInfoService.checkIn(checkinInfoDAO);
        return CommonResult.successResponse(checkinInfoDAO);

    }
}

